<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        for(var number = 100;number <= 999;number ++ ){
            var gewei = number % 10;//个位
            var shiwei = (number / 10) % 10; //十位
            var baiwei = (number / 100) % 10; // 百位
            // 由于是出发可能有小数 所以取整
            gewei = parseInt(gewei);
            shiwei = parseInt(shiwei);
            baiwei = parseInt(baiwei);
            if (number ==
                gewei * gewei * gewei +
                shiwei * shiwei * shiwei +
                baiwei * baiwei * baiwei
            ) {
                console.log('%s是水仙花数', number);
            }
        }

    </script>
</body>

</html>